package demo;

import org.fcs.framework.generator.*;

import httl.Engine;
import httl.Template;

import java.io.FileWriter;
import java.io.IOException;
import java.text.ParseException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2016/2/22.
 */

public class Test {
    public static void main(String[] args) throws IOException, ParseException {
    	Engine engine=Engine.getEngine();
    	Template template =engine.getTemplate("template/test.httl");
    	 Map<String, Object> parameters = new HashMap<String, Object>();
    	parameters.put("a", 5);
    	parameters.put("b", 3);
    	Variables v=new Variables();
    	v.setA(5);
    	v.setB(3);
    	String a=template.evaluate(v).toString();
    	
    	new GeneratorController().process("test");
    	
    	List<String[]> all=DataInfo.readTables();
    	Class c=all.getClass();
    	
    	List<String> tables=DataInfo.readTables("TABLE");
        String tableName = "test";
        Generator generator;
        generator = new GeneratorPoImpl();
//        generator = new GeneratorMapper();
//        generator = new GeneratorMapperXml();
//        generator = new GeneratorService();
//        generator = new GeneratorServiceImpl();
        //      generator = new GeneratorMapperXml();
        for(String table:tables){
        	FileWriter fw=new FileWriter(table);
        	fw.write(generator.process(table));
        	fw.close();
        }
        System.out.println("Write over!");
//        String result = generator.process(tableName);
//        System.out.println(result);
    }
}
